<?php
class PayLogServer {
	public function add($data){
		$data['add_time'] =time();
		HttpDaoManager::getPayLogDao()->add($data);
	}
	
	public function addForOrder($data){
		$payLogData= array();
		$payLogData['target_id'] = $data['id'];
		$payLogData['target_sn'] = $data['order_no'];
		$payLogData['amount'] = $data['money'];
		$payLogData['pay_type'] =$data['pay_type'];
		$payLogData['type'] = ORDER;
		$payLogData['add_time'] = time();
		$payLogData['add_user'] =$_SESSION['user']['english_name'];
		$payLogData['user_id'] =$_SESSION['user']['id'];
		$payLogData['status']= PAY_STATUS_UNCOFIRMED;
		if($data['pay_type']==PAY_TYPE_BALANCE){
			$payLogData['status']= PAY_STATUS_CONFIRMED;
		}
		return HttpDaoManager::getPayLogDao()->add($payLogData);
	}

	public function addForSaving($data){
		$payLogData= array();
		$payLogData['target_id'] = '';
		$payLogData['target_sn'] = '';
		$payLogData['amount'] =  $data['money'];
		$payLogData['pay_type'] =$data['pay_type'];
		$payLogData['type'] = SAVING;
		$payLogData['add_time'] = time();
		$payLogData['add_user'] =$_SESSION['user']['english_name'];
		$payLogData['user_id'] =$_SESSION['user']['id'];
		$payLogData['status']= PAY_STATUS_UNCOFIRMED;
		
		return HttpDaoManager::getPayLogDao()->add($payLogData);
	}
}

?>